function scroll(event) {
	if (event.wheelDelta > 0) //wheel up
		navigationList(SLIDE_RIGHT);
	else
		navigationList(SLIDE_LEFT);
}

function navigationList(event) {
	var selectedDiv = document.getElementById('listItemSelected');
	
	var e = event || window.event;
	var code = e.keyCode || e;

	switch (code) {
		case SLIDE_LEFT:
			var newDiv = selectedDiv.nextSibling;
			
			if (newDiv === null) {//bottom reachted
				if (currendIndex < listContents.length-1) {//is there a next element?
					currendIndex++;
					var startIndex = currendIndex - (currendIndex % entriesPerPage);
					var endIndex = Math.min(listContents.length, startIndex+entriesPerPage);
					injectListContents(funcName);
				}
			}
			else {
				currendIndex++;
				selectedDiv.id = '';
				newDiv.id = 'listItemSelected';
			}
			break;
		case SLIDE_RIGHT:
			var newDiv = selectedDiv.previousSibling;
			
			if (newDiv === null) {//upper bound reached
				if (currendIndex > 0) {//is there a previous element?
					currendIndex--;
					var startIndex = currendIndex - (currendIndex % entriesPerPage);
					var endIndex = Math.min(listContents.length, startIndex+entriesPerPage);
					injectListContents(funcName);
				}
			}
			else {
				currendIndex--;
				selectedDiv.id = '';
				newDiv.id = 'listItemSelected';
			}
			break;
		case PUSH_WHEEL:
		case PUSH_WHEEL_2:
			sessionStorage.setItem('selectedConversation', JSON.stringify(listContents[currendIndex]));
			sessionStorage.setItem('selectedIndexConversation', currendIndex);
			callNextDialog();
			break;
		case BACK:
			if (!isFirstPage)
				history.back();
			break;
		case SK_NW:
			leftTopSoftKey();
			break;
		case SK_NE:
			rightTopSoftKey();
			break;
		case SK_SW:
		case SK_SW_2:
			leftBottomSoftKey();
			break;
		case SK_SE:
		case SK_SE_2:
			rightBottomSoftKey();
			break;
		case VOLUME_UP:
			break;
		case VOLUME_DOWN:
			break;
		case PTT:
			startSpeechInput();
			break;
		default:
			console.info('unkown key pressed. ignoring: ' + e.keyCode);
			break;
	}
}

function injectListContents(funcName) {
	var innerHTML = '';
	var startIndex = currendIndex - (currendIndex % entriesPerPage);
	var endIndex = Math.min(listContents.length, startIndex+entriesPerPage);
	for (var i=startIndex; i<endIndex; i++) {
		var isSelected = currendIndex === i ? true : false;
		innerHTML += window[funcName](i, isSelected);
	}
	document.getElementById('listItems').innerHTML = innerHTML;
}

function createListEntryStringConversation(i, isSelected) {
	var idSelected = isSelected === true ? ' id="listItemSelected"' : '';
	var ret = '<div' + idSelected + ' class="listItem">' +
					'<img class="followMailLinkImg" src="./Audi_MMI_Files/media/link2.png" />' +
					'<div class="mailFirstLine">' +
						'<span>' +
							listContents[i].conversationTopic + ' (' + listContents[i].indexSelected + ')' + asdad
						'</span>' +
					'</div>' +
				'</div>';
	return ret;
}